package com.github.tvbox.osc.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.github.tvbox.osc.R
import io.github.source.media.bean.MediaCategory

/**
 * @ClassName: HomeSortAdapter
 * @Description: TODO(列表分类)
 * @author: huangrongcai
 * @date: 2024/5/28
 *
 * @Copyright: 黄嵘才（HuangRc)
 */
class HomeSortAdapter(
    layoutResId: Int,
    data: MutableList<MediaCategory>? = mutableListOf()
) :
    BaseQuickAdapter<MediaCategory, BaseViewHolder>(layoutResId, data) {
    /*#UI 需要将这个动态处理起来通过配置文件去获取*/

    constructor() : this(layoutResId = R.layout.item_home_sort, mutableListOf()) {

    }

    override fun convert(helper: BaseViewHolder?, item: MediaCategory?) {
        helper?.setText(R.id.tvTitle, item?.name)
    }

    companion object {
        @JvmStatic
        fun createData(obj: Any?): MutableList<MediaCategory?> {
            if (obj == null) {
                return mutableListOf()
            }
            //解析对象
            return mutableListOf(MediaCategory.objectFrom(obj.toString()))
        }
    }



}